﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Data;
using System.Reflection;
using System.Runtime.Serialization;
using System.Data.Objects;

namespace GTServices.Entities
{
    public class FileInfo : BaseEntity
    {
        
        [IgnoreDataMember]
        public String FullName
        {
            get
            {
                return Path + "\\" + Name;
            }
        }
        public String Path { get; set; }
        public String Name { get; set; }
        public string Notes { get; set; }

        public virtual FileExtension FileExtension { get; set; }
        
        public FileInfo()
        {
            this.Name = "";
            this.Path = "";
            this.Notes = ""; 
        }

        public override void Validate()
        {
            if (String.IsNullOrEmpty(Name))
            {
                throw new ArgumentException("Null or Empty Name");
            }

            if (String.IsNullOrEmpty(Path))
            {
                throw new ArgumentException("Null or Empty Path");
            }
        }

        public override bool Equals(object obj)
        {
            if (!(obj is FileInfo))
            {
                return false;
            }
            return (obj as FileInfo).FullName == this.FullName;
        }

        public override string ToString()
        {
            return FullName;
        }
    }
}
